﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Painter
{

    public partial class PaintWindow : Form
    {
        private enum Tools { Pencil, Line, Eraser, Rectangle }

        private Tools tool;

        bool drag = false;

        int x1;
        int y1;

        public PaintWindow()
        {
            InitializeComponent();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void picutreBox1_MouseDown(object sender, MouseEventArgs e)
        {
            drag = true;
            x1 = e.X;
            y1 = e.Y;

        }

        private void pictureBox1_MouseDrag(object sender, MouseEventArgs e)
        {
            Graphics g = this.pictureBox1.CreateGraphics();
            Pen myPen = new Pen(Color.Black, 1);
            if (drag == true)
            {
                switch (tool)
                {
                    case Tools.Pencil:
                        g.DrawLine(myPen, x1, y1, e.X, e.Y);
                        x1 = e.X;
                        y1 = e.Y;
                        break;
                }
            }
        }

        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            drag = false;
        }

        private void pencilButton_Click(object sender, EventArgs e)
        {
            tool = Tools.Pencil;
        }

        private void paintcanButton_Click(object sender, EventArgs e)
        {

        }

        private void textButton_Click(object sender, EventArgs e)
        {

        }

        private void eraserButton_Click(object sender, EventArgs e)
        {

        }

        private void dropperButton_Click(object sender, EventArgs e)
        {

        }

        private void zoomButton_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            colorDialog1.ShowDialog();
        }

        private void button1_Click_1(object sender, EventArgs e)
        {

        }

        private void selectButton_Click(object sender, EventArgs e)
        {

        }
    }
}
